
<%@ page import="com.capgemini.rdlgae.domain.Facture" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'facture.label', default: 'Facture')}" />
        <title><g:message code="default.show.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.show.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="dialog">
                <table>
                    <tbody>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="facture.id.label" default="Id" /></td>
                            
                            <td valign="top" class="value">${fieldValue(bean: factureInstance, field: "id")}</td>
                            
                        </tr>
          
                       <tr class="prop">
                            <td valign="top" class="name"><g:message code="facture.dateEdition.label" default="Date Edition" /></td>
                            
                            <td valign="top" class="value"><g:formatDate date="${factureInstance?.dateEdition}" /></td>
                            
                        </tr>
                                  
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="facture.commandes.label" default="Commandes" /></td>
                            
                            <td valign="top" style="text-align: left;" class="value">
                                              <table>
                    <thead>
                        <tr>
                        
                        	<th><g:message code="commande.utilisateur.label" default="Utilisateur" /></th>                           
                        
                            <th><g:message code="commande.entree.label" default="Entree" /></th>
                   	    
                            <th><g:message code="commande.plat.label" default="Plat" /></th>
                   	    
                            <th><g:message code="commande.dessert.label" default="Dessert" /></th>
                            
                            <th><g:message code="commande.total.label" default="Total" /></th>
                        
	                   	    <th><g:message code="commande.action.label" default="Action" /></th>
                            
                   	    
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${factureInstance.commandes}" status="i" var="commandeInstance">
                    
                    <g:if test="${date != commandeInstance.dateCommande }">
                    	<g:set var="date" value="${commandeInstance.dateCommande}"/>
                    	<tr>
                    		<td colspan="5"><h3>Le <g:formatDate date="${commandeInstance.dateCommande}" format="EEEE d MMMM"/> </h3>
                    		
                    		
                    		
                    		</td>
                    	
                    	</tr>
                    	                   
                    </g:if>
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            
                        
                        	<td>${fieldValue(bean: commandeInstance, field: "utilisateur")}</td>
                        
                            <td>${fieldValue(bean: commandeInstance, field: "entree")}</td>
                        
                            <td>${fieldValue(bean: commandeInstance, field: "plat")}</td>
                        
                            <td>${fieldValue(bean: commandeInstance, field: "dessert")}</td>
                            
                            <td>${fieldValue(bean: commandeInstance, field: "total")} €</td>
                            
                            <td><g:link action="show" id="${commandeInstance.id}">Voir/Modifier</g:link></td>
                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
                            </td>
                            
                        </tr>
          
                        
                         <tr class="prop">
                            <td valign="top" class="name"><g:message code="facture.total.label" default="Total" /></td>
                            
                            <td valign="top" class="value">${factureInstance.total} €</td>
                            
                        </tr>
                    
                    </tbody>
                </table>
            </div>
            <div class="buttons">
                <g:form>
                    <g:hiddenField name="id" value="${factureInstance?.id}" />
                    <span class="button"><g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </g:form>
            </div>
        </div>
    </body>
</html>
